package com.mybatis_plus.demo.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.mybatis_plus.demo.entity.Favorites;
import com.mybatis_plus.demo.dao.FavoritesDao;
import com.mybatis_plus.demo.service.IFavoritesService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;


/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author lbb
 * @since 2018-10-16
 */
@Service("iFavoritesService")
public class FavoritesServiceImpl extends ServiceImpl<FavoritesDao, Favorites> implements IFavoritesService {

    @Resource
    private FavoritesDao favoritesDao;

    @Override
    public void selsetgetFavorites() {




        Favorites favorites = new Favorites();

        favorites.setName("文章一");
        favorites.setCount(10L);
        favorites.setCreateTime(System.currentTimeMillis());
        favorites.setUserId(13L);
        favorites.setPublicCount(1L);
        favorites.setLastModifyTime(System.currentTimeMillis());
        boolean a = favorites.insert();


        EntityWrapper<Favorites> fWrapper = new EntityWrapper<Favorites>();

        fWrapper.eq("id",1).eq("public_count",2);

        fWrapper.like("name","列表");

        System.out.println(fWrapper.getSqlSelect());
        System.out.println(fWrapper.getSqlSegment());

        List<Favorites> favorites3 = favoritesDao.selectList(fWrapper);


        List<Favorites> favorites2 = this.selectList(fWrapper);


        List<Favorites> list = favorites.selectList(fWrapper);

        int i = favorites.selectCount(fWrapper);
        Favorites favorites1 = favorites.selectOne(fWrapper);

        boolean update = favorites.update(fWrapper);




    }
}
